<?php
define('ROOT','E:/wwwroot/cms/');
class tpl_rep {
	private $disk_root;
	private $static_path;
	private $http_domain;
	private $index;
	private $list_index;
	private $list_i;
	private $show;
	
	public function __construct(){
		$this->disk_root=ROOT;
		$this->static_path='html/';
		$this->http_domain='http://www.cms.com/';
		$this->http_root='/';
		$this->index=array('index.html');
		$this->list_index=array('{cat}/index.html');
		$this->list_i=array('{cat}/list_{i}.html');
		$this->show=array('{cat}/{id}.html');
	}
	public function index(){
		return array(
			'http'=>$this->http_root.$this->index[0],
			'file'=>$this->disk_root.$this->index[0],
			'http_full'=>$this->http_domain,
			'db'=>$this->index[0]
		);
	}
	public function list_index($d){
		$t=str_replace(array('{cat}'),array($d['cat']),$this->list_index[0]);
		return array(
			'http'=>$this->http_root.$this->static_path.$t,
			'file'=>$this->disk_root.$this->static_path.$t,
			'http_full'=>$this->http_domain.$this->static_path.$t,
			'db'=>$t
		);
	}
	public function list_i($d){
		$t=str_replace(array('{cat}','{i}'),array($d['cat'],$d['i']),$this->list_i[0]);
		return array(
			'http'=>$this->http_root.$this->static_path.$t,
			'file'=>$this->disk_root.$this->static_path.$t,
			'http_full'=>$this->http_domain.$this->static_path.$t,
			'db'=>$t
		);
	}
	public function show($d){
		$t=str_replace(array('{cat}','{id}'),array($d['cat'],$d['id']),$this->show[0]);
		return array(
			'http'=>$this->http_root.$this->static_path.$t,
			'file'=>$this->disk_root.$this->static_path.$t,
			'http_full'=>$this->http_domain.$this->static_path.$t,
			'db'=>$t
		);
	}

//
}

$tpl_rep=new tpl_rep();

echo '<pre>';
$r=$tpl_rep->index();
print_r($r);

$r=$tpl_rep->list_index(array('cat'=>5));
print_r($r);

$r=$tpl_rep->list_i(array('cat'=>6,'i'=>10));
print_r($r);

$r=$tpl_rep->show(array('cat'=>2,'id'=>888));
print_r($r);
